<template>
	<view class="myArticle">
		<tui-tab :tabs="tabs" :size="30" 
				@change="change"
				bold color="#999" 
				selectedColor="#07c160" 
				sliderBgColor="#07c160"></tui-tab>
		<view  v-if="nowTab == 0 && showArticle">
			<myNote ref="myNote"></myNote>
		</view>
		<view v-if="nowTab == 1 && showArticle">
			<myCollect ref="myCollect"></myCollect>
		</view>
		
	</view>
</template>

<script>
import myNote from './my-note/my-note.vue';
import myCollect from './my-collect/my-collect.vue';
export default {
	
	components: {
		myNote,
		myCollect
	},
	data(){
		return {
			tabs: ['笔记', '收藏'],
			nowTab: 0,
			showArticle: false
		}
		
	},
	onLoad(){
		this.showArticle = !this.checkReLogin();
		console.log(this.showArticle )
	},
	methods: {
		change(e){
			this.nowTab = e.index;
		},
		loadData(){
			if(!this.checkReLogin()){
				this.showArticle = true;
				this.$refs.myNote.loadData();
				this.$refs.myCollect.loadData();
			}
			
		},
		checkReLogin(){
			let flag = false;
			let userInfo = uni.getStorageSync("user_info");
			if(userInfo == null || userInfo == '' ){
				flag = true;
			}
			return flag;
		},
	}
}
</script>

<style>
	page{
		height: 100vh;
		background-color: #F5F6FA;
	}

	.myArticle{
		width: 100%;
	}
</style>